#! /bin/sh
#
# gocomtask
#
# chkconfig: - 90 10
# description: gocomtask
# processname: gocomtask

start(){
    stop
	cd /GoComWp/gocomapps/lighttask/
	nohup $JAVA_HOME/bin/java -jar gocomtask-2.0.0.jar --server.port=11503 >nohup.out 2>&1 &
	echo "start gocomtask!"
}

stop(){

	echo "stop gocomtask!"
	pid=$(ps -ef |grep java |awk '{if($10 ~/gocomtask/) {print $2}}')
	if [ ! -z $pid ]; then
		echo $pid
		kill -9 $pid
	fi
}

restart(){
	stop
	start
}

status(){

	pid=$(ps -ef |grep java |awk '{if($10 ~/gocomtask/) {print $2}}')
	if [ ! -z $pid ]; then
		echo "$pid gocomtask is run!"
	else
		echo "gocomtask not started!"
	fi
}

case "$1" in
	start)
	start
	;;
	stop)
	stop
	;;
	restart)
	restart
	;;
	status)
	status
	;;
	*)
	echo "Usage: $0 {start|stop|status|restart}"

	exit 2
esac

exit $?


